package com.xhd.char_base54;
import 	sun.misc.BASE64Decoder; 

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Calendar;
import java.util.Date;

public class base64_UTF8_delphi {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws UnsupportedEncodingException 
	 */
	private static Calendar calendar = Calendar.getInstance();
    private static int gmtOffset = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET);

    public static double JTime2DTime(Date javaTime){
        long sysMillis = javaTime.getTime() + gmtOffset;
        return sysMillis / 86400000 + 25569 + ((double) (sysMillis % 86400000) / 86400000);
     }


	public static void main(String[] args) throws UnsupportedEncodingException, IOException {
		// TODO Auto-generated method stub
/*    String  x ="*5ZCR5Y2O5LicKjEwMDA=*1331357472";
    x =x.substring(1);
    System.out.println(x);
    BASE64Decoder decoder = new BASE64Decoder();
    byte[] bs ;
    bs = decoder.decodeBuffer(x);
  //  bs = x.getBytes("UTF-8");
    System.out.println("bs"+bs) ;
    String  xx = new String(bs,"UTF-8");
    System.out.println(xx);
    
    String by = new String(decoder.decodeBuffer(x),"UTF-8");
    System.currentTimeMillis();
    by =  URLDecoder.decode(by,"UTF-8");
    System.out.println(by);
    String UAndtime = "";*/
	Date date =new Date();
	//Date date =new Date(System.currentTimeMillis()/86400000*86400000-(23-Calendar.ZONE_OFFSET)*3600000);   
    System.out.println(JTime2DTime(date));  
    
    System.out.println(System.currentTimeMillis());// 1331361638031  
    //1331361914062
	}

}
